package com.hzzc.sso.sdk;

import com.hzzc.BizException;
import com.hzzc.Result;
import com.hzzc.api.AuthorityBean;
import com.hzzc.api.SSOApplicationUserAuthorityView;
import com.hzzc.sso.sdk.session.SessionManager;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 用户服务
 * <p>
 * --用户登录服务
 * --用户登录验证服务
 */
public class UserAuthorityService {

    @Autowired
    private SsoWebSdkProperties ssoWebSdkProperties;

    @Autowired
    private RemoteUserAuthorityService remoteUserAuthorityService;

    /**
     * 获取用户的权限视图
     *
     * @return
     * @throws BizException
     */
    public Result<SSOApplicationUserAuthorityView> getUserApplicationUserAuthorityView() throws BizException {
        return remoteUserAuthorityService.getUserApplicationUserAuthorityView(new AuthorityBean().setApp(ssoWebSdkProperties.getApp()).setCode(SessionManager.localCode.get()));
    }


}
